<template>
  <div class="start-menu">
    <system
      class="menu-collaps"
      :data="user"
      @toggle="expand=!expand;$emit('toggle')"
      @userConfig="$emit('userConfig')"
      @signOut="$emit('signOut')"
      @systemConfig="$emit('systemConfig')"
    />
    <panel-tree
      v-show="!expand"
      class="menu-tree"
      :data="menu"
      :show-icon="true"
      :show-filter="false"
      @click="$emit('menuClick',$event);"
      @dblclick="$emit('menuClick',$event);"
      @contextmenu="menuRightClick"
    />
  </div>
</template>
<script>
export default {
  name: 'StartMenu',
  components: {
    System: () => import('@windows/Collaps-H.vue'),
    PanelTree: () => import('@components/PanelTree.vue')
  },
  props: {
    user: {
      type: Object,
      default: () => null
    },
    menu: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      expand: false
    }
  },
  methods: {
    menuRightClick(data, event) {
      this.$emit('menuRightClick', data, event)
    }
  }
}
</script>
<style scoped>
.start-menu {
  display: flex;
  background-color: rgba(17, 17, 17, 0.95);
}
.menu-collaps {
  height: 100%;
}
.menu-tree {
  flex-grow: 1;
}
.start-menu /deep/ .list-node {
  color: #fff;
}
.start-menu /deep/ .list-node:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
}
</style>
